<?php
include(dirname(__FILE__) . '/init.php');

$request = new Request();
$response = new Response();

$routing_map = array(
  '/session/'   =>  'Session_Controller',
  '/t/'         =>  'Test_Controller',
  '/admin/'     =>  'Admin_Controller',
  '/student/'   =>  'Student_Controller',
  '/teacher/'   =>  'Teacher_Controller',
  '/courseSelection/'  => 'CourseSelection_Controller',
  //make sure '/' at the end of map
  '/'           =>  'Home_Controller',
);

list($ctl_name, $method) = route($routing_map, $request, $response);

if (!$ctl_name || !$method) {
  $response->send('Not Found', 404);
}

$controller = new $ctl_name($request, $response, $method);
$controller->$method($request, $response);

$response->send();
